package com.niit.session17;

import java.util.ArrayList;

public class ArrayListDemo {
	public static void main(String[] args) {
		ArrayList<Boolean> arrayList = new ArrayList<Boolean>();
//		ArrayList可以存储重复的元素，而且存储的元素是有序
		arrayList.add(false);
		arrayList.add(true);
		arrayList.add(true);
		arrayList.add(true);
		System.out.println(arrayList);
		System.out.println("通过下标获取元素"+arrayList.get(0));
//		使用增强for循环遍历ArrayList
		for (Boolean boolean1 : arrayList) {
			System.out.println(boolean1);
		}
//		使用普通for循环遍历ArrayList
		for (int i = 0; i < arrayList.size(); i++) {
			System.out.println(arrayList.get(i));
		}
	}

}
